floor
Leave the method of sorting
floor()
function rounds down to the closest integer.
In this example, we will apply floor()
function to different numbers:
<?php echo ( floor ( 0.60 ) ) ; echo ( floor ( 0.40 ) ) ; echo ( floor ( 5 ) ) ; echo ( floor ( 5.1 ) ) ; echo ( floor ( - 5.1 ) ) ; echo ( floor ( - 5.9 ) ) ?>
Try it yourself
floor ( x )
parameter | describe |
---|---|
x | Required. A number. |
Returns the next integer no greater than x and rounds the decimal part of x . The type returned by floor() is still float, because the range of float values is usually larger than integer.